<template>
    <div>
      <h1>用户列表</h1>
      <table class="table table-bordered">
        <tbody>
            <tr class="bg-primary">
                <td>编号</td>
                <td>用户名</td>
                <td>用户账号</td>
                <td>用户密码</td>
                <td>手机号</td>
                <td>所属角色</td>
                <td>创建人</td>
                <td>操作</td>
            </tr>
            <tr v-for="item in list":key="item.Lid">
                <td>{{item.Lid}}</td>
                <td>{{item.Name}}</td>
                <td>{{item.UserName}}</td>
                <td>****</td>
                <td>{{item.Phone.substring(0,3)+'****'+item.Phone.substring(7)}}</td>
                <td>{{item.RoleNmae}}</td>
                <td>{{item.CreateName}}</td>
                <td>
                    <input type="text" value="删除" class="btn btn-danger">
                </td>
            </tr>
        </tbody>
      </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted}from 'vue';
import axios from 'axios';
import moment from 'moment';

import {useRouter,useRoute} from 'vue-router';
const router=useRouter();
const route=useRoute();

import { useStore } from '@/stores/user';
const a=useStore();

let list:any=ref([]);

onMounted(()=>{
    if(a.userinfo.Lid){
        getuserlist();
    }
    else{
        router.push('/loginadd');
    }
    
})

const getuserlist=()=>{
    axios({
        url:'/api/Login/GetUserlogin',
        method:'get',
        params:list,
    })
    .then(res=>{
        console.log(res);
        list.value=res.data;
    })
}

</script>

<style scoped>

</style>